package socketmvc.core.exception;

public class ResponseException extends SocketMvcBaseException {

    private final Object responseMsg;

    public ResponseException(Object responseMsg){
        this.responseMsg = responseMsg;
    }

    public ResponseException(Exception e){
        super(e);
        this.responseMsg = e;
    }

    public Object getResponseMsg() {
        return responseMsg;
    }

    @Override
    public String getMessage(){
        if (responseMsg instanceof Exception){
            return ((Exception) responseMsg).getMessage();
        }
        return String.valueOf(responseMsg);
    }
}
